//*** Guidance generated code ***//
using System;
using System.Collections.Generic;
using System.Linq;

using ProjectBase.Core;

namespace Survey.Entity.Services.HowTos
{
    /// <summary>
    /// Entity ComplexEntity.
    /// </summary>
    [Serializable]
    [CLSCompliant(false)]
    public class ComplexEntity : Persistent<long>
    {
        public virtual string Code { get; set; }
        public virtual string ShortName { get; set; }
        public virtual string VeryLongName { get; set; }

        public virtual SimpleEntity SimpleCombo { get; set; }
        public virtual SimpleEntity SimpleAsync { get; set; }
        public virtual SimpleEntity SimpleAuto { get; set; }

        #region bool byte[]
        public virtual bool IsApproved { get; set; }
        public virtual bool IsSigned { get; set; }
        public virtual byte[] Image { get; set; }
        public virtual string ImageFileName { get; set; } // will be bounded to the uploaded file name - SmartBinder
        #endregion bool byte[]

        #region ValueTypes
        public virtual byte ByteValue { get; set; }
        public virtual sbyte SByteValue { get; set; }
        public virtual byte? ByteValueNullable { get; set; }
        public virtual sbyte? SByteValueNullable { get; set; }

        public virtual short ShortValue { get; set; }
        public virtual ushort UShortValue { get; set; }
        public virtual short? ShortValueNullable { get; set; }
        public virtual ushort? UShortValueNullable { get; set; }

        public virtual int IntValue { get; set; }
        public virtual uint UIntValue { get; set; }
        public virtual int? IntValueNullable { get; set; }
        public virtual uint? UIntValueNullable { get; set; }

        public virtual long LongValue { get; set; }
        public virtual ulong ULongValue { get; set; }
        public virtual long? LongValueNullable { get; set; }
        public virtual ulong? ULongValueNullable { get; set; }

        public virtual decimal DecimalValue { get; set; }
        public virtual decimal? DecimalValueNullable { get; set; }

        public virtual float FloatValue { get; set; }
        public virtual float? FloatValueNullable { get; set; }

        public virtual double DoubleValue { get; set; }
        public virtual double? DoubleValueNullable { get; set; }

        public virtual Guid GuidValue { get; set; }
        public virtual Guid? GuidValueNullable { get; set; }

        public virtual DateTime? ValidFrom { get; set; }
        public virtual DateTime? ValidTo { get; set; }

        #endregion ValueTypes

        #region override abstract
        /// <summary>
        /// Provides quick, string description about the 'ComplexEntity' instance
        /// </summary>
        public override string ToDisplay()
        {
            // This method is often used on View
            // there for provide clear and understandable
            // set of properties (separated by spaces ' ')
            // which will quickly provide information about this instance
            return IDToDisplay + " " + ShortName;
        }

        /// <summary>
        /// Returned value should be handled as business unique key.
        /// Equal method (implemented in Tracked base class) will use it
        /// to compare two ComplexEntitys
        /// </summary>
        protected override string GetDomainObjectSignature()
        {
            // TODO return the property (or list of properties separated by "|")
            // which will allow to distinguish among entities
            return Code;
        }

        #endregion override abstract
    }
}


